/**
 * This class owns all the informations of the processes and the Program
 * 
 * @author	Druid YANG, (ADD HERE)
 * @version	0.00, 2008/10/08
 */

package extra.switcher;

import java.awt.Image;
import java.util.ArrayList;
import java.util.List;

public class ExtraSwitchData {
	// Process Informations
	public List<ExtraSwitchProcessInfo> ProsessInfos;
	public ExtraSwitchData () {
		state = 0;
		ProsessInfos = new ArrayList<ExtraSwitchProcessInfo>();
		ExtraSwitchProcessInfoGetter.getProsessInfo(this);
	}
	
	/*
	 *  State of the process
	 *  used for syn of Multithread
	 *  
	 *  0 creating
	 *  1 wait for user
	 *  2 getting informations
	 *  3 waitting for click
	 *  4 closing
	 *  5 Terminating
	 */
	private Integer state;
	
	/**
	 * This Method used for add Process Info
	 * @return ture when success, false when failed
	 */
	public boolean AddProcessInfo(int HANDLE, String WindowTitle, Image Icon, Image FormCaption) {
		ExtraSwitchProcessInfo NewProcessInfo = new ExtraSwitchProcessInfo();
		if (Icon == null) {
			Icon = FormCaption;
		}
		NewProcessInfo.setHANDLE(HANDLE);
		NewProcessInfo.setWindowTitle(WindowTitle);
		NewProcessInfo.setIcon(Icon);
		NewProcessInfo.setFromCaption(FormCaption);
		return ProsessInfos.add(NewProcessInfo);
	}
}



class ExtraSwitchProcessInfo {
	private int HANDLE;
	private String WindowTitle;
	private Image Icon;
	private Image FromCaption;
	
	public int getHANDLE() {
		return HANDLE;
	}
	public void setHANDLE(int handle) {
		HANDLE = handle;
	}
	public String getWindowTitle() {
		return WindowTitle;
	}
	public void setWindowTitle(String windowTitle) {
		WindowTitle = windowTitle;
	}
	public Image getIcon() {
		return Icon;
	}
	public void setIcon(Image icon) {
		Icon = icon;
	}
	public Image getFromCaption() {
		return FromCaption;
	}
	public void setFromCaption(Image fromCaption) {
		FromCaption = fromCaption;
	}
}
